﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WarehouseManagement.Shared.Settings
{
    [Serializable]
    public class DatabaseSettings
    {
        public string ServerName { get; set; }
        public bool WindowsAuthentication { get; set; }
        public string Username { get; set; }

        public string Password { get; set; }

        public string DatabaseName { get; set; }

        public string ConnectionString
        {
            get
            {
                return string.Format("Data Source={0};Initial Catalog={1}; User Id = {2}; Password = {3}; Integrated Security={4}"
                    , ServerName, DatabaseName, Username, Password, WindowsAuthentication ? "True" : "False");
            }
        }

        public DatabaseSettings() { }

        public DatabaseSettings(DatabaseSettings existing)
        {
            this.ServerName = existing.ServerName;
            this.DatabaseName = existing.DatabaseName;
            this.Password = existing.Password;
            this.Username = existing.Username;
            this.WindowsAuthentication = existing.WindowsAuthentication;
        }
    }
}
